package com.ph.irp.base.assistantmaterial.service.impl;

import java.util.List;

import com.ph.irp.base.assistantmaterial.dao.PBaseAssistantmaterialBalancedeadlineDAO;
import com.ph.irp.base.assistantmaterial.service.PBaseAssistantmaterialBalancedeadlineService;
import com.ph.irp.model.PBaseAssistantmaterialBalancedeadline;

public class PBaseAssistantmaterialBalancedeadlineServiceImpl implements
		PBaseAssistantmaterialBalancedeadlineService {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7721542154942814793L;
	// 结算方式dao
	private PBaseAssistantmaterialBalancedeadlineDAO deadlineDAOProxy;

	public PBaseAssistantmaterialBalancedeadlineDAO getDeadlineDAOProxy() {
		return deadlineDAOProxy;
	}

	public void setDeadlineDAOProxy(
			PBaseAssistantmaterialBalancedeadlineDAO deadlineDAOProxy) {
		this.deadlineDAOProxy = deadlineDAOProxy;
	}

	/**
	 * 新增结算期限
	 */
	@Override
	public void addBalancedeadline(
			PBaseAssistantmaterialBalancedeadline balancedeadlineModel)
			throws Throwable {
		// TODO Auto-generated method stub

		deadlineDAOProxy.addBalancedeadline(balancedeadlineModel);
	}

	/**
	 * 批量删除结算期限
	 */
	@Override
	public void deleteBalancedeadline(String[] balancedeadlineIds)
			throws Throwable {
		for (String balancedeadlineId : balancedeadlineIds)
			deadlineDAOProxy.deleteBalancedeadline(balancedeadlineId);
	}

	/**
	 * 动态查询结算期限
	 */
	/*
	 * @Override public List<PBaseAssistantmaterialBalancedeadline>
	 * getBalancedeadlines(PBaseAssistantmaterialBalancedeadline deadlineModel)
	 * throws Throwable { // TODO Auto-generated method stub //结算期限list List<PBaseAssistantmaterialBalancedeadline>
	 * deadlineList = null ;
	 * 
	 * if(deadlineModel==null){ deadlineList =
	 * deadlineDAOProxy.getAllBalancedeadlines() ; } else{ //结算期限name String
	 * name = deadlineModel.getBalanceDeadLineName(); //结算期限code String code =
	 * deadlineModel.getBalanceDeadLineCode() ;
	 * if(!name.equals("")&&!code.equals("")){ deadlineList =
	 * deadlineDAOProxy.getBalancedeadlineByNameAndCode(name, code) ; } else
	 * if(!name.equals("")){ deadlineList =
	 * deadlineDAOProxy.getBalancedeadlineByName(name) ; } else
	 * if(!code.equals("")){ deadlineList =
	 * deadlineDAOProxy.getBalancedeadlineByCode(code) ; } else{ deadlineList =
	 * deadlineDAOProxy.getAllBalancedeadlines() ; } }
	 * 
	 * return deadlineList; }
	 */

	/**
	 * 根据结算期限id查询结算期限
	 */
	@Override
	public PBaseAssistantmaterialBalancedeadline getBalancedeadlineById(
			Integer balancedeadlineId) throws Throwable {
		// TODO Auto-generated method stub
		// 结算方式model
		PBaseAssistantmaterialBalancedeadline deadlineModel = null;

		deadlineModel = deadlineDAOProxy
				.getBalancedeadlineById(balancedeadlineId);
		return deadlineModel;
	}

	/**
	 * 更新结算期限
	 */
	@Override
	public void updateBalancedeadline(
			PBaseAssistantmaterialBalancedeadline balancedeadlineModel)
			throws Throwable {
		// TODO Auto-generated method stub
		deadlineDAOProxy.updateBalancedeadline(balancedeadlineModel);
	}

	@Override
	public List<PBaseAssistantmaterialBalancedeadline> getAllBalancedeadlines()
			throws Throwable {
		return deadlineDAOProxy.getAllBalancedeadlines();
	}

	@Override
	public List<PBaseAssistantmaterialBalancedeadline> getBalancedeadlinesByCode(
			String balancedeadlineCode) throws Throwable {
		return deadlineDAOProxy.getBalancedeadlineByCode(balancedeadlineCode);
	}

	@Override
	public List<PBaseAssistantmaterialBalancedeadline> getBalancedeadlinesByCodeAndName(
			String balancedeadlineCode, String balancedeadlineName)
			throws Throwable {
		return deadlineDAOProxy.getBalancedeadlineByNameAndCode(balancedeadlineName, balancedeadlineCode);
	}

	@Override
	public List<PBaseAssistantmaterialBalancedeadline> getBalancedeadlinesByName(
			String balancedeadlineName) throws Throwable {
		return deadlineDAOProxy.getBalancedeadlineByName(balancedeadlineName);
	}

}
